// Command class is the type of command to be executed
// it is created by Analyzer, stored in Invoker

#ifndef COMMAND_H
#define COMMAND_H
#include <string>
#include "TimedEvent.h"
#include "Feedback.h"
#include "Receiver.h"

//@author A0105735J
enum CommandType{
	CommandTypeAdd, CommandTypeDelete, CommandTypeUpdate, CommandTypeSearch, CommandTypeInvalid, CommandTypeDisplay, CommandTypeRead, CommandTypeMark, CommandTypeCheck
};

//@author A0105730U
class Command{
protected:
	CommandType type; 
	// this message contains some error message set by Analyzer
	Error message;
public:
	Command();
	~Command(void);

	void setMessage(Error);
	Error getMessage();
	void setInvalid();
	bool isValid();
	
	//@author A0105735J
	// get the command type of the command
	CommandType getCommandType();
	//@author A0105735J
	// all subclass have this virtual function
	// execute the command
	virtual Feedback execute(Receiver* theE);
	//@author A0105735J
	// undo the command
	// some subclass do not provide undo function
	// such as searchCommnad, displayCommnad and so on
	virtual Feedback undo(Receiver* theE);
};
#endif